using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using LeederWinApp.Model;
using LeederWinApp.Service;
using Leeder.Business;

namespace LeederWinApp.Business
{
    /// <summary>
    /// 
    /// </summary>
   public class SetupBLL : BaseBLL<SetupModel, SetupService>
   {
        public SetupBLL()
        {
            Service = new SetupService();
        }

        public List<SetupModel> GetModelAll()
        {
            var result = Service.Query(p => (p.IsPhantom != true || p.IsPhantom == null));
            if(!result.IsSuccess)
            {
                LogObj.Error(result.Dsca);
                return null;
            }
            return result.ActivedObj;
        }

        public SetupModel GetModel()
        {
            var result= Service.Query(p => (p.IsPhantom != true || p.IsPhantom == null));
            if (!result.IsSuccess)
            {
                LogObj.Error(result.Dsca);
                return null;
            }
            return result.ActivedObj.FirstOrDefault();
        }
    }
}
